From fcde973e26c585ade21bb16dd13df5205a4f0998 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Tue, 15 Nov 2005 18:43:28 +0100 Subject: [PATCH] Ensure we initialise the cpu_present_map before topology_init() is called. In latest Linux kernels it iterates over cpu_present_map rather than cpu_possible_map. Also, save/restore should really iterate over possible cpus, not present ones (not that it really matters, but it's a small cleanup). Signed-off-by: Keir Fraser --- linux-2.6-xen-sparse/arch/xen/kernel/reboot.c | 2 +- linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c index 89c2005450..81f0f10c21 100644 --- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c +++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c @@ -188,7 +188,7 @@ static int __do_suspend(void *ignore) xenbus_resume(); #ifdef CONFIG_SMP - for_each_present_cpu(i) + for_each_cpu(i) vcpu_prepare(i); out_reenable_cpus: diff --git a/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c b/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c index 31ea6473f1..66bb891ec6 100644 --- a/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c +++ b/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c @@ -277,6 +277,18 @@ void __devinit smp_prepare_boot_cpu(void) #ifdef CONFIG_HOTPLUG_CPU +/* + * Initialize cpu_present_map late to skip SMP boot code in init/main.c. + * But do it early enough to catch critical for_each_present_cpu() loops + * in i386-specific code. + */ +static int __init initialize_cpu_present_map(void) +{ + cpu_present_map = cpu_possible_map; + return 0; +} +core_initcall(initialize_cpu_present_map); + static void vcpu_hotplug(unsigned int cpu) { int err; @@ -293,7 +305,6 @@ static void vcpu_hotplug(unsigned int cpu) } if (strcmp(state, "online") == 0) { - cpu_set(cpu, cpu_present_map); (void)cpu_up(cpu); } else if (strcmp(state, "offline") == 0) { (void)cpu_down(cpu); -- 2.30.2